﻿using UnityEngine;
using System.Collections;

public class EnemyActions : MonoBehaviour {
	//variables used
	RaycastHit enemyRayHit = new RaycastHit();
	Ray enemyRay = new Ray();
	public Transform target ;
	float m_Speed = 40;
	public Guns Tip;
	//public Guns Trigger;
	//public float distance;
	//Transform enemy;
	Vector3 previousPosition;
	Vector3 newPosition;
	// Use this for initialization
	void Start ()
	{
		previousPosition = transform.position;
		newPosition = previousPosition - newPosition;
	}
	// actions possible de l'ennemi
	void Update () 
	{	
		transform.position = Vector3.MoveTowards (transform.position, target.position, m_Speed * Time.deltaTime);
		transform.LookAt (target);
		
		Tip.EnemyShoot(transform.position + (-transform.forward * 25), transform.rotation);
		
		/*if (newPosition = previousPosition - transform.position)
		{
			Shoot ();
		}*/
		
	}
	
}
